package oracle.springbootxm.service.impl;

import oracle.springbootxm.dao.goodsdao.GoodsMapper;
import oracle.springbootxm.pojo.GoodsInfo;
import oracle.springbootxm.pojo.UserGoodsInfo;
import oracle.springbootxm.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class GoodsServiceImpl implements GoodsService {

    @Autowired
    private GoodsMapper goodsMapper;

    @Override
    public List<GoodsInfo> queryGoodsInfoAll() {
        return goodsMapper.queryGoodsInfoAll();
    }

    @Override
    public void addGoods(Map map) {
        goodsMapper.addGoods(map);
    }

    @Override
    public UserGoodsInfo queryuserGoods(int userid, int goodsid) {
        UserGoodsInfo userGoodsInfo = goodsMapper.queryuserGoods(userid, goodsid);
        return userGoodsInfo;
    }

    @Override
    public void updateCount(int countsum, int goodsid) {
        goodsMapper.updateCount(countsum, goodsid);
    }

    @Override
    public GoodsInfo queryshowGoods(int goodsid) {
        return goodsMapper.queryshowGoods(goodsid);
    }

    @Override
    public GoodsInfo queryshowGoodsid(int userid) {
        GoodsInfo goodsInfo = goodsMapper.queryshowGoodsid(userid);
        return goodsInfo;
    }

    @Override
    public List<UserGoodsInfo> queryuserAllGoods(int userid) {
        List<UserGoodsInfo> userGoodsInfo = goodsMapper.queryuserAllGoods(userid);
        return userGoodsInfo;
    }

    @Override
    public void deleteGoods(int userid, int goodsid) {
        goodsMapper.deleteGoods(userid, goodsid);
    }

    @Override
    public void deleteStoreGoods(int goodsid){
        goodsMapper.deleteStoreGoods(goodsid);
    }

    @Override
    public void addNewGoods(GoodsInfo goodsInfo){
        goodsMapper.addNewGoods(goodsInfo);
    }

    @Override
    public GoodsInfo querynewGoods(String goodsname){
       return goodsMapper.querynewGoods(goodsname);
    }
}
